<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	
	
	<p id="text">输入的值：</p>
	<input type="text" id="inputText">
	

	<script>
		
		var obj = {};

		Object.defineProperty(obj,'hello',{ 
			get: function() {
				console.log('正在执行get')
			},
			set: function(newVal) {
				//console.log(newVal)
				document.getElementById('text').innerHTML = newVal;
				document.getElementById('inputText').value = newVal;
			}
		})

		document.addEventListener('keyup',function(e) {
			obj.hello = e.target.value;
		})

	</script>
</body>
</html>
